package models

import (
	"github.com/astaxie/beego/orm"
	_ "github.com/go-sql-driver/mysql"
	"time"
)

/*
@Project        :   tmp_report
@FileName       :   baseinfo.go
@Author         :   tangchaolizi
@Datetime       :   2020/7/25 11:47 上午
@Software       :   GoLand
@Show           :
*/

type UserTable struct {
	Id       int `orm:"pk"`
	Username string
	Password string
}

type TmpInfo struct {
	Id          int
	Name        string
	Temperature string
	Value1      bool
	Value2      bool
	Value3      bool
	Value4      bool
	Value5      bool
	Value6      bool
	Value7      bool
	Value8      bool
	Value9      bool
	ReportTime  time.Time `orm:"auto_now_add;type(datetime)" form:"-"`
}

type Staff struct {
	Id         int       `json:"id"`
	Name       string    `json:"name"`
	CreateTime time.Time `json:"createtime" orm:"auto_now_add;type(datetime)" form:"-"`
}

func init() {
	_ = orm.RegisterDataBase("default", "mysql", "tmp_info:tmp_info123@@tcp(rm-2ze6pqdr2zs556752ko.mysql.rds.aliyuncs.com:3306)/test_tmp_report?charset=utf8&loc=Asia%2FShanghai", 30)
	orm.RegisterModel(new(UserTable), new(TmpInfo), new(Staff))
	_ = orm.RunSyncdb("default", false, true)
	orm.Debug = true

}
